package top.vybfi.week2.customer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//控制层

@RequestMapping(path = "api/V1/user")
@Deprecated
@RestController
public class CustomerController {
    private final CustomerService customerService;

    @Autowired
    public CustomerController(CustomerService customerService) {
        this.customerService = customerService;
    }

    //增删改查

    @GetMapping(value = "all")
    User getuser(){
        System.out.println("GET请求...");
        return new User(123345,"23232323", "2333@email.com","233@email.com");

    }

    @PostMapping
    void createNewUser(@RequestBody User user){
        System.out.println("POST请求...");
        System.out.println(user);
    }

    @PutMapping
    void updateUser(@RequestBody User user){
        System.out.println("UPDATE请求...");
        System.out.println(user);
    }

    @DeleteMapping(path = "{userId}")
    void deleteUser(@PathVariable("userId") long id){
        System.out.println("DELETE请求...\n"+id);
    }
}
